package com.command.command;

public class TestController {
    public static void main(String[] args) {
        //初始化一下遥控器
        RemotController remotController = new RemotController();
        //命令的实际执行者
        LightCommandReceiver lightCommandReceiver = new LightCommandReceiver();
        //给遥控器的前两个按钮绑定命令
        remotController.setCommandForButton(1,
                new LightOnCommand(lightCommandReceiver) ,
                new LightOffCommand(lightCommandReceiver) );

        //按下按钮去开灯
        //点击了第一行的开按钮
        remotController.onButtonWasPushed(1);
        //点击了第一行的关按钮
        remotController.offButtonWasPushed(1);

        //撤销上次操作
        remotController.back();
    }
}
